package com.ruoyi.system.controller;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.JingfeiZhuanjiaMonth;
import com.ruoyi.system.service.IJingfeiZhuanjiaMonthService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * jingfeizhuanjiayueController
 * 
 * @author ruoyi
 * @date 2024-07-11
 */
@Controller
@RequestMapping("/system/jingfeizhuanjiamonth")
public class JingfeiZhuanjiaMonthController extends BaseController
{
    private String prefix = "system/jingfeizhuanjiamonth";

    @Autowired
    private IJingfeiZhuanjiaMonthService jingfeiZhuanjiaMonthService;

    @RequiresPermissions("system:jingfeizhuanjiamonth:view")
    @GetMapping()
    public String month()
    {
        return prefix + "/month";
    }

    /**
     * 查询jingfeizhuanjiayue列表
     */
    @RequiresPermissions("system:jingfeizhuanjiamonth:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(JingfeiZhuanjiaMonth jingfeiZhuanjiaMonth)
    {
        startPage();
        List<JingfeiZhuanjiaMonth> list = jingfeiZhuanjiaMonthService.selectJingfeiZhuanjiaMonthList(jingfeiZhuanjiaMonth);
        return getDataTable(list);
    }

    /**
     * 导出jingfeizhuanjiayue列表
     */
    @RequiresPermissions("system:jingfeizhuanjiamonth:export")
    @Log(title = "jingfeizhuanjiayue", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(JingfeiZhuanjiaMonth jingfeiZhuanjiaMonth)
    {
        List<JingfeiZhuanjiaMonth> list = jingfeiZhuanjiaMonthService.selectJingfeiZhuanjiaMonthList(jingfeiZhuanjiaMonth);
        ExcelUtil<JingfeiZhuanjiaMonth> util = new ExcelUtil<JingfeiZhuanjiaMonth>(JingfeiZhuanjiaMonth.class);
        return util.exportExcel(list, "jingfeizhuanjiayue数据");
    }

    /**
     * 新增jingfeizhuanjiayue
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存jingfeizhuanjiayue
     */
    @RequiresPermissions("system:jingfeizhuanjiamonth:add")
    @Log(title = "jingfeizhuanjiayue", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(JingfeiZhuanjiaMonth jingfeiZhuanjiaMonth)
    {
        return toAjax(jingfeiZhuanjiaMonthService.insertJingfeiZhuanjiaMonth(jingfeiZhuanjiaMonth));
    }

    /**
     * 修改jingfeizhuanjiayue
     */
    @RequiresPermissions("system:jingfeizhuanjiamonth:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") String id, ModelMap mmap)
    {
        JingfeiZhuanjiaMonth jingfeiZhuanjiaMonth = jingfeiZhuanjiaMonthService.selectJingfeiZhuanjiaMonthById(id);
        mmap.put("jingfeiZhuanjiaMonth", jingfeiZhuanjiaMonth);
        return prefix + "/edit";
    }

    /**
     * 修改保存jingfeizhuanjiayue
     */
    @RequiresPermissions("system:jingfeizhuanjiamonth:edit")
    @Log(title = "jingfeizhuanjiayue", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(JingfeiZhuanjiaMonth jingfeiZhuanjiaMonth)
    {
        return toAjax(jingfeiZhuanjiaMonthService.updateJingfeiZhuanjiaMonth(jingfeiZhuanjiaMonth));
    }

    /**
     * 删除jingfeizhuanjiayue
     */
    @RequiresPermissions("system:jingfeizhuanjiamonth:remove")
    @Log(title = "jingfeizhuanjiayue", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(jingfeiZhuanjiaMonthService.deleteJingfeiZhuanjiaMonthByIds(ids));
    }
}
